<?php
/* @var $this SiteController */
/* @var $model ContactForm */
/* @var $form CActiveForm */

$this->pageTitle = Yii::app()->name . ' - Contact Us';
$this->breadcrumbs = array(
    Yii::t('contactus', 'contactus'),
);
?>
<div id="focus" class="wrapper row100 bgded" style="background-image:url('images/live-demo/background-03.jpg');">
    <div class="overlay">
        <div id="newsletter" class="clear center">
            <h2 class="uppercase font-x3 btmspace-50"><?= Yii::t('contactus', 'contactus') ?></h2>

            <?php if (Yii::app()->user->hasFlash('contact')): ?>

                <div class="flash-success">
                    <?php echo Yii::app()->user->getFlash('contact'); ?>
                </div>

            <?php else: ?>

                <p><?= Yii::t('contactus', 'information') ?></p>

                <div class="form">

                    <?php
                    $form = $this->beginWidget('CActiveForm', array(
                        'id' => 'contact-form',
                        'enableClientValidation' => true,
                        'clientOptions' => array(
                            'validateOnSubmit' => true,
                        ),
                    ));
                    ?>

                    <?php echo $form->errorSummary($model); ?>

                    <div class="row">
                        <?php echo $form->textField($model, 'name', array('placeholder' => Yii::t('contactus', 'name'))); ?>
                        <?php echo $form->error($model, 'name'); ?>
                    </div>

                    <div class="row">
                        <?php echo $form->textField($model, 'email', array('placeholder' => Yii::t('contactus', 'email'))); ?>
                        <?php echo $form->error($model, 'email'); ?>
                    </div>

                    <div class="row">
                        <?php echo $form->textField($model, 'subject', array('maxlength' => 150, 'placeholder' => Yii::t('contactus', 'subject'))); ?>
                        <?php echo $form->error($model, 'subject'); ?>
                    </div>

                    <div class="row">
                        <?php echo $form->textArea($model, 'body', array('maxlength' => 300, 'placeholder' => Yii::t('contactus', 'detail'))); ?>
                        <?php echo $form->error($model, 'body'); ?>
                    </div>

                    <?php if (CCaptcha::checkRequirements()): ?>
                        <div class="row">
                            <?php
                            $this->widget('CCaptcha', array(
                                'buttonType' => 'link',
                                'clickableImage' => true,
                                'showRefreshButton' => false,
                                    )
                            );
                            ?>
                        </div>
                        <p><?= Yii::t('contactus', 'chage_image') ?></p>
                        <div class="row">
                            <?php echo $form->textField($model, 'verifyCode', array('placeholder' => Yii::t('contactus', 'verify_code'))); ?>
                            <?php echo $form->error($model, 'verifyCode'); ?>
                        </div>
                    <?php endif; ?>

                    <div class="row buttons">
                        <?php echo CHtml::tag('button', array('class' => 'btn', 'type' => 'submit'), Yii::t('contactus', 'contactus')); ?>
                    </div>

                    <?php $this->endWidget(); ?>

                </div><!-- form -->

            <?php endif; ?>
        </div>
    </div>
</div>